package syntax

import scala.collection.mutable.ArrayBuffer

class CChain
{
    private val value = ArrayBuffer[CCategory]()

    def apply() = value

    def this(category:CCategory) =
    {
        this()
        value += category
    }

    def &(category:CCategory):CChain =
    {
        value += category
        this
    }

    def |(chain:CChain):CAlternatives = CAlternatives() | this | chain

    def |(category:CCategory):CAlternatives = this | CChain(category)

}

object CChain
{
    def apply() = new CChain

    def apply(category:CCategory) = new CChain(category)
}